﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace SHDM
{
    public class TextUtil
    {
        /// <summary>
        /// md5 32位
        /// </summary>
        /// <param name="plainText"></param>
        /// <returns></returns>
        public static string MD5Encrypt(string plainText)
        {
            string result = "";
            MD5 md5 = MD5.Create();
            byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(plainText));
            for (int i = 0; i < s.Length; i++)
            {
                result = result + s[i].ToString("x").PadLeft(2, '0');
            }
            return result;
        }
    }
}
